<html>
<head>
    <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.css" rel="stylesheet">
    <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
    <script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.19.1/moment.min.js"></script>
    {% if title %}
        <title>{{ title }} - microblog</title>
    {% else %}
        <title>micro-blog</title>
    {% endif %}
</head>

<body>
<div class="container">
    <div class="row clearfix">
        <div class="col-md-12 column">
            <nav class="navbar navbar-default" role="navigation">
                <div class="navbar-header">
                    <button type="button" class="navbar-toggle" data-toggle="collapse"
                            data-target="#bs-example-navbar-collapse-1"><span
                            class="sr-only">Toggle navigation</span><span class="icon-bar"></span><span
                            class="icon-bar"></span><span class="icon-bar"></span></button>
                    <a class="navbar-brand" href="#">Microblog</a>
                </div>
                <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                    <ul class="nav navbar-nav">
                        <li>
                            <a href="{{ url_for('index') }}">Home</a>
                        </li>
                        <li>
                            {% if g.user.is_authenticated %}
                                <a href="{{ url_for('user',nickname=g.user.nickname) }}">Your Profile</a>
                            {% endif %}
                        </li>
                        <li class="dropdown">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown<strong
                                    class="caret"></strong></a>
                            <ul class="dropdown-menu">
                                <li>
                                    <a href="#">Action</a>
                                </li>
                                <li>
                                    <a href="#">Another action</a>
                                </li>
                                <li>
                                    <a href="#">Something else here</a>
                                </li>
                            </ul>
                        </li>
                    </ul>

                    {% if g.user.is_authenticated %}
                        <form class="navbar-form navbar-left" role="search" action="{{ url_for('search') }}"
                              method="post" name="search">
                            <div class="form-group">
                                {{ g.search_form.hidden_tag() }}{{ g.search_form.search(size=20,class="form-control") }}
                            </div>
                            {#                            <button type="submit" class="btn btn-default">Submit</button>#}
                            <input type="submit" class="btn btn-default" value="Search">
                        </form>
                    {% endif %}
                    <ul class="nav navbar-nav navbar-right">
                        <li>
                            {% if g.user.is_authenticated %}
                                <a href="{{ url_for('logout') }}">Logout</a>
                            {% endif %}
                        </li>
                        <li class="dropdown">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown">Other<strong
                                    class="caret"></strong></a>
                            <ul class="dropdown-menu">
                                <li>
                                    <a href="#">Action</a>
                                </li>
                                <li>
                                    <a href="#">Another action</a>
                                </li>
                            </ul>
                        </li>
                    </ul>
                </div>
            </nav>
        </div>
    </div>
</div>

<!--闪现flask消息-->
{% with messages = get_flashed_messages() %}
    {% if messages %}
        <div class="container">
            <div class="row clearfix">
                <div class="col-md-12 column">
                    <div class="alert alert-success alert-dismissable">
                        <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                        <strong>Info!</strong>
                        <ul class="container">
                            {% for message in messages %}
                                <li>{{ message }} </li>
                            {% endfor %}
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    {% endif %}
{% endwith %}

<!--字模板-->
<div class="container">
    <div class="row clearfix">
        <div class="col-md-12 column">
            {% block content %}{% endblock %}
        </div>
    </div>
</div>

</body>
</html>